package org.apache.flink.runtime.allocatedeploy;

import java.util.concurrent.CompletableFuture;

import org.apache.flink.runtime.ResourceException;
import org.apache.flink.runtime.allocatedeploy.execution.Execution;

/** Operations on the {@link BusinessExecution}. */
public interface ExecutionOperations {

    /**
     * Deploy the execution.
     *
     * @param execution to deploy.
     * @throws JobException if the execution cannot be deployed to the assigned resource
     */
    void deploy(Execution execution) throws ResourceException;

    /**
     * Cancel the execution.
     *
     * @param execution to cancel
     * @return Future which completes when the cancellation is done
     */
    CompletableFuture<?> cancel(Execution execution);

    /**
     * Mark the execution as FAILED.
     *
     * @param execution to mark as failed.
     * @param cause of the execution failure
     */
    void markFailed(Execution execution, Throwable cause);
}
